<template>
<div class="container">
    <button @click="change">xianshi</button>
    <input v-show="isShow" type="text" ref="input"/>
</div>
</template>

<script>
export default {
    name:'Test',
    data(){
        return {
            isShow: false
        }
    },
    methods:{
        change(){
            this.isShow = !this.isShow;
            this.$nextTick(() => {
                this.$refs.input.focus();
            })  
        }
    }
}
</script>

<style scoped>
.container{
    width: 200px;
    margin: 100px auto;
    box-sizing: border-box;
}
</style>